﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ERF
{
    /// <summary>
    /// Provides logic for displaying on-screen messages.
    /// </summary>
    public class GameConsole
    {
        public static short MessageAmount = 10;
        private static GameConsole instance;
        
        public static GameConsole GetInstance
        {
            get {
                if(instance == null)
                    instance = new GameConsole();

                return instance;
            }
        }

        private Queue<String> messages;

        /// <summary>
        /// Gets a queue of the messages being displayed.
        /// </summary>
        public Queue<String> Messages
        {
            get
            {
                return messages;
            }
        }

        private GameConsole()
        {
            messages = new Queue<String>();
        }
    
        /// <summary>
        /// Adds a new message for display on the screen.
        /// </summary>
        /// <param name="message"></param>
        public void AddMessage(String message) {
            messages.Enqueue(message);

            if (messages.Count > GameConsole.MessageAmount)
                messages.Dequeue();
        }
    }
}
